import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:geomancy/styles/index.dart';
import 'package:geomancy/tools/utils.dart';

class CommonBtnWidget extends StatelessWidget {
  final String? txt;
  final void Function() onTap;
  final Size? size;
  final double? fontSize;
  final Widget? child;
  final bool disabled;
  final bool active;
  const CommonBtnWidget({super.key, this.txt, required this.onTap, this.size, this.fontSize, this.child, this.disabled = false, this.active = true});

  @override
  Widget build(BuildContext context) {
    return Material(
      color: active ? ColorStyle.themeColor.withOpacity(disabled ? 0.5 : 1) : ColorStyle.themeLightColor.withOpacity(disabled ? 0.5 : 1),
      borderRadius: BorderRadius.all(Radius.circular(50.w)),
      child: InkWell(
        onTap: disabled ? null : () {
          Utils.shake();
          onTap();
        },
        borderRadius: BorderRadius.all(Radius.circular(50.w)),
        highlightColor: const Color.fromRGBO(240, 171, 7, 1),
        splashColor: const Color.fromRGBO(240, 171, 7, 1),
        child: Container(
          width: size?.width ?? 590.w,
          height: size?.height ?? 100.w,
          alignment: Alignment.center,
          decoration: BoxDecoration(
            borderRadius: BorderRadius.all(Radius.circular(50.w)),
            border: Border.all(width: 5.w, color: ColorStyle.borderColor),
          ),
          child: child ?? Text(txt??'', style: TextStyle(fontSize: fontSize ?? 30.sp, color: ColorStyle.textColor, fontWeight: FontWeight.w400),),
        ),
      ),
    );
  }
}
